# windows/linux--py2/3 均支持
import paramiko

hostname = '192.168.75.124'
port = 22  
username = 'moocos'  
password = ' '
s = paramiko.SSHClient()  

#读取know_host  
s.load_system_host_keys()  
#建立SSH连接  
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.connect(hostname,port,username,password)

stdin,stdout,stderr = s.exec_command('ls -l /home/moocos')  
for x in stdout.readlines():
    print(x.strip())
s.close() 